package es.udc.emarketapp.emarket.model.countryFacade.actions;

import java.sql.Connection;

import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAO;
import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAOFactory;

import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.NonTransactionalPlainAction;

public class FindByIdActionOld implements NonTransactionalPlainAction {

    private String idPais;
    private String language;

    public FindByIdActionOld(String idPais) {
        this.idPais = idPais;
    }

    public FindByIdActionOld(String idPais, String language) {
        this.idPais = idPais;
        this.language = language;
    }

    /**
     *
     * @return the <code>ProductVO</code>
     */
    public Object execute(Connection connection)
            throws InstanceNotFoundException, InternalErrorException {

        SQLCountryDAO countryDAO = SQLCountryDAOFactory.getDAO();

        /*
        if (language.equals("es")) {
            return countryDAO.findByIdEs(connection, idPais);
        } else {
            return countryDAO.findById(connection, idPais);
        }
         * */

        return countryDAO.findById(connection, idPais, language);

    }
}
